﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using System.ComponentModel;

namespace SIMA.Controls
{
    /// <summary>
    /// Lógica de interacción para BusyRibbon.xaml
    /// </summary>
    public partial class SIMABusyRibbon : UserControl
    {

  

        public SIMABusyRibbon(string text)
        {
            InitializeComponent();
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.Visibility = Visibility.Hidden;
        }
        
        public void StartBusy(string action)
        {
            txtOperationContext.Text = action;
            Storyboard watchbusy = (Storyboard)FindResource("BusyLine");

            DoubleAnimation da = (DoubleAnimation)watchbusy.Children[0];

            da.To = RootGrid.ActualWidth;

            watchbusy.Begin(this, true);
            this.Visibility = Visibility.Visible;
        }
        public void StopBusy()
        {
            Storyboard watchbusy = (Storyboard)FindResource("BusyLine");
            watchbusy.Stop(this);
            this.Visibility = Visibility.Hidden;
        }


    }
}
